<script setup lang="ts">
import {useRoute,useRouter} from "vue-router";
import {Setting, InfoFilled, Search, Menu, Document, HomeFilled} from '@element-plus/icons-vue'
import {onMounted} from "vue";
import userDetailStore from '@/store/mod/hospitalDetail.ts'
// 获取仓库对象
let detailStore = userDetailStore();
const $route = useRoute()
// console.log($route.path)
onMounted(()=>{
  // 获取医院详情的数据
  detailStore.getHospital($route.query.hoscode as string)
  //获取某一个医院科室的数据
  detailStore.getDepartment($route.query.hoscode as string)
})
const $router = useRouter()
function changeActive(routerPath:string){
  $router.push({
    path:routerPath,
    query:{
      hoscode:$route.query.hoscode
    }
  })
}
</script>

<template>
<div class="hospital">
  <div class="menu">
    <div class="top">
      <el-icon><HomeFilled /></el-icon>
      <span> / 医院信息</span>
    </div>
    <el-menu
        :default-active="$route.path"
        class="el-menu-vertical-demo"
    >
      <el-menu-item index="/hospital/register" @click="changeActive('/hospital/register')">
        <el-icon><Menu /></el-icon>
        <span>预约挂号</span>
      </el-menu-item>
      <el-menu-item index="/hospital/detail" @click="changeActive('/hospital/detail')">
        <el-icon><document /></el-icon>
        <span>医院详情</span>
      </el-menu-item>
      <el-menu-item index="/hospital/notice" @click="changeActive('/hospital/notice')">
        <el-icon><setting /></el-icon>
        <span>预约须知</span>
      </el-menu-item>
      <el-menu-item index="/hospital/close" @click="changeActive('/hospital/close')">
        <el-icon><InfoFilled /></el-icon>
        <span>停诊信息</span>
      </el-menu-item>
      <el-menu-item index="/hospital/search" @click="changeActive('/hospital/search')">
        <el-icon><Search /></el-icon>
        <span>查询/取消</span>
      </el-menu-item>
    </el-menu>
  </div>
  <div class="content">
    <router-view></router-view>
  </div>
</div>
</template>
<style scoped lang="scss">
.hospital{
  display: flex;
  .menu{
    flex:2;
    .top{
      margin-left: 24px;
      margin-top: 15px;
      display: flex;
      flex-direction: row;
    }
  }
  .content{
    flex:8;
  }
}
</style>